package com.skywolf.chem.home.controller;


import com.skywolf.chem.common.sysconfig.response.RespData;
import com.skywolf.chem.home.param.LoopImgParam;
import com.skywolf.chem.home.service.ILoopImgService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 
 * @since 2020-12-15
 */
@RestController
@RequestMapping("/edu/home")
public class LoopImgController {

    @Autowired
    ILoopImgService loopImgService;

    @ApiOperation(value = "获取轮播图",notes = "获取轮播图")
    @RequestMapping(value = "/getLoopImg",method = {RequestMethod.GET},produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public RespData<List<LoopImgParam>> getLoopImg(HttpServletRequest request) {
        List<LoopImgParam> params = loopImgService.getLoopImgs();
        if(params==null){
            params = new ArrayList<>();
        }
        return RespData.success(params);
    }
}
